/*
 * Copyright © 2004-2014 chenYuan. All rights reserved.
 * @Website:wwww.jspx.net
 * @Mail:39793751@qq.com
 * @author: chenYuan , 陈原
 * @License: Jspx.net Framework Code is open source (LGPL)，Jspx.net Framework 使用LGPL 开源授权协议发布。
 * @jvm:jdk1.6+  x86/amd64
 *
 */
package com.jspx.sioc.factory;

import com.jspx.boot.environment.Environment;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User:chenYuan (mail:39793751@qq.com)
 * Date: 2007-2-13
 * Time: 10:59:43
 */

final public class LifecycleObject implements Serializable
{
    final private Map<String, Object> paramMap = new HashMap<String, Object>();
    private long createDate = System.currentTimeMillis();
    private String create;
    private Object object;
    private String name;
    private boolean isSingleton = true;
    private String className;
    private String destroyMethod;
    private String initMethod;
    //真实命名空间,配置
    private String namespace = Environment.Global;
    //虚拟命名空间
    private String refNamespace = Environment.Global;

    public String getNamespace()
    {
        return namespace;
    }

    public void setNamespace(String namespace)
    {
        this.namespace = namespace;
    }

    public Map<String, Object> getParamMap()
    {
        return paramMap;
    }

    public void setParamMap(Map<String, Object> paramMap)
    {
        this.paramMap.putAll(paramMap);
    }

    public long getCreateDate()
    {
        return createDate;
    }

    public void setCreateDate(long createDate)
    {
        this.createDate = createDate;
    }

    public String getCreate()
    {
        return create;
    }

    public void setCreate(String create)
    {
        this.create = create;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public boolean isSingleton()
    {
        return isSingleton;
    }

    public void setSingleton(boolean singleton)
    {
        isSingleton = singleton;
    }

    public String getClassName()
    {
        if (className == null) return null;
        return className.trim();
    }

    public void setClassName(String className)
    {
        this.className = className;
    }

    public String getDestroyMethod()
    {
        return destroyMethod;
    }

    public void setDestroyMethod(String destroyMethod)
    {
        this.destroyMethod = destroyMethod;
    }

    public String getInitMethod()
    {
        return initMethod;
    }

    public void setInitMethod(String initMethod)
    {
        this.initMethod = initMethod;
    }

    public Object getObject()
    {
        return object;
    }

    public void setObject(Object object)
    {
        this.object = object;
    }

    public String getRefNamespace() {
        if (!Environment.Global.equals(refNamespace)) return refNamespace;
        return namespace;
    }

    public void setRefNamespace(String refNamespace) {
        this.refNamespace = refNamespace;
    }

    public void clear()
    {
        object = null;
        name = null;
        initMethod = null;
        destroyMethod = null;
        className = null;
        refNamespace=null;
    }


}